<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
	Object obj = request.getSession().getAttribute("role_resource");
	if (null == obj) {
		response.setStatus(1000);
		return;
	}
%>
<script type="text/javascript">

	//外包商下拉列表
	var epiboly_store = new Ext.data.JsonStore({
		root : "data",
		fields : [ "id", "name" ],
		url : "epiboly!listAll.action"
	});

	//搜索条件外包商下拉列表
	var epiboly_store1 = new Ext.data.JsonStore({
		root : "data",
		fields : [ "id", "name" ],
		url : "epiboly!listAll.action",
		listeners : {
			"load" : function() {
				var RecordName = Ext.data.Record.create([ {
					name : "id"
				}, {
					name : "name"
				} ]);
				var newRecord = new RecordName({
					id : "",
					name : "全部"
				});
				this.insert(0, newRecord);
			}
		}
	});

	//插槽列表数据源
	var data_store = new Ext.data.JsonStore({
		root : "data",
		totalProperty : "total",
		fields : [ "foldoutid", "epibolyno", "foldoutname", "foldoutpri",
				"epibolyname" ],
		url : "foldOut!list.action"
	});

	//定义数据显示面板
	var p1 = {
		id : "p1",
		xtype: "grid",
		stripeRows:true,
		loadMask : true,//在加载数据时遮罩住元素,替换元素Updater的加载提示器，并且在初始化加载之后销毁
		autoExpandColumn: "epibolyname",
		autoExpandMin : 100,//自动填充最小宽度
		store : data_store,
		headersDisabled: true,
		columns : [ new Ext.grid.RowNumberer({
			header : "序号",
			width : 35
		}), {
			header : "外包商名称",
			dataIndex : "epibolyname",
			id : "epibolyname",
			menuDisabled: true
		}, {
			header : "插槽编号",
			dataIndex : "foldoutid",
			menuDisabled: true
		}, {
			header : "插槽名称",
			dataIndex : "foldoutname",
			menuDisabled: true
		}, {
			header : "优先级",
			dataIndex : "foldoutpri",
			menuDisabled: true
		} ],
		bbar : new Ext.ux.PagingToolbar({
			id : "foldoutPaging",
			pageSize : limit,
			store : data_store
		}),
		tbar : ["&nbsp&nbsp外包商:",
				{
					id : "a",
					xtype : "billCombox",
					displayField : "name",
					width:120,
					store : epiboly_store1,
					listeners : {
						"select" : function() {
							data_store.baseParams = data_store.baseParams || {};

							data_store.baseParams["foldOut.epibolyno"] = Ext.getCmp("a").getValue();

							data_store.load({
								params : {
									start : 0,
									limit : limit
								}
							});

						}
					}
				} ]
	};

	data_store.load({
		params : {
			start : 0,
			limit : limit
		}
	});
	epiboly_store.load();
	epiboly_store1.load({
		callback : function() {
			Ext.getCmp("a").setValue("");
		}
	});


	var CenterPanel = Ext.getCmp("CenterPanel");
	CenterPanel.removeAll();
	CenterPanel.add(p1);
	CenterPanel.doLayout();
</script>

